In [1]:
print "hello world"
In [2]:
l = [1,2,3]
In [3]:
help(l)
In [ ]:
markdown test, i can write normal text here and it will not run as code!
In [4]:
# this is a comment and will not run in the code
In [5]:
'''this is just a mulit line comment'''
Out[5]:
In [6]:
pwd
Out[6]:
In [7]:
#addition
2+1
Out[7]:
In [8]:
# substraction
2-1
Out[8]:
In [9]:
1-2
Out[9]:
In [10]:
2*2
Out[10]:
In [11]:
3/2
Out[11]:
In [12]:
3.0/2
Out[12]:
In [13]:
float(3)/2
Out[13]:
In [14]:
3/float(2)
Out[14]:
In [18]:
from __future__ import division
3/2
Out[18]:
In [19]:
1/2
Out[19]:
In [20]:
2/3
Out[20]:
In [21]:
root(2)
In [22]:
sqrt(2)
In [23]:
4^2
Out[23]:
In [24]:
4^.5
In [25]:
4**.5
Out[25]:
In [26]:
a=5
In [27]:
a=6
a+a
Out[27]:
In [28]:
a
Out[28]:
In [29]:
0.1+0.2-0.3
Out[29]:
In [30]:
'hello'
Out[30]:
In [31]:
'this entire thing can be a string'
Out[31]:
In [32]:
"this is using double quotes"
Out[32]:
In [33]:
print 'hello'
In [34]:
print("hello")
In [35]:
s='hello'
In [36]:
s
Out[36]:
In [37]:
len(s)
Out[37]:
In [38]:
print(s)
In [39]:
s[3]
Out[39]:
In [40]:
s[10]
In [42]:
s[5]
In [47]:
s[2:4]
Out[47]:
In [48]:
z*10
In [49]:
letter='z'
letter*10
Out[49]:
In [50]:
letter.upper()
Out[50]:
In [52]:
letter.center('z')
In [53]:
print 'this is a string'
strings yoiu can use the %s to format strings into your print statements
In [55]:
s = 'STRING'
print 'place another string with a mod and s: %s' %(s)
In [56]:
from __future__ import print_function
In [57]:
print('hello')
In [58]:
print('one: {x}'.format(x='INSERT'))
In [ ]: